Imports System.Data
Imports System.Data.SqlClient
Public Class oLogin
    Public Sub GetPermission(ByVal dt As DataTable)
        For i As Integer = 0 To dt.Rows.Count - 1
            Select Case dt.Rows(i).Item("FUNC_CODE").ToString
                Case "Sales_Quantity"
                    PublicVariable.Sales_Quantity = dt.Rows(i).Item("Sales_Quantity")
                Case "Sales_Discount"
                    PublicVariable.Sales_Discount = dt.Rows(i).Item("Sales_Discount")
                Case "Sales_Remove"
                    PublicVariable.Sales_Remove = dt.Rows(i).Item("Sales_Remove")
                Case "Sales_Settle"
                    PublicVariable.Sales_Settle = dt.Rows(i).Item("Sales_Settle")
                Case "Sales_Save"
                    PublicVariable.Sales_Save = dt.Rows(i).Item("Sales_Save")
                Case "Sales_KEEP"
                    PublicVariable.Sales_KEEP = dt.Rows(i).Item("Sales_KEEP")
                Case "Sales_PACK"
                    PublicVariable.Sales_PACK = dt.Rows(i).Item("Sales_PACK")
                Case "Sales_Recall"
                    PublicVariable.Sales_Recall = dt.Rows(i).Item("Sales_Recall")
                Case "Sales_Refund"
                    PublicVariable.Sales_Refund = dt.Rows(i).Item("Sales_Refund")
                Case "Sales_Memo"
                    PublicVariable.Sales_Memo = dt.Rows(i).Item("Sales_Memo")
                Case "Reservation_Search"
                    PublicVariable.Reservation_Search = dt.Rows(i).Item("Reservation_Search")
                Case "Reservation_New"
                    PublicVariable.Reservation_New = dt.Rows(i).Item("Reservation_New")
                Case "Reservation_Edit"
                    PublicVariable.Reservation_Edit = dt.Rows(i).Item("Reservation_Edit")
                Case "Reservation_CheckIn"
                    PublicVariable.Reservation_CheckIn = dt.Rows(i).Item("Reservation_Check-In")
                Case "Reservation_Delete"
                    PublicVariable.Reservation_Delete = dt.Rows(i).Item("Reservation_Delete")
                Case "Settle_Cash"
                    PublicVariable.Settle_Cash = dt.Rows(i).Item("Settle_Cash")
                Case "Settle_Voucher"
                    PublicVariable.Settle_Voucher = dt.Rows(i).Item("Settle_Voucher")
                Case "Settle_CreditCard"
                    PublicVariable.Settle_CreditCard = dt.Rows(i).Item("Settle_CreditCard")
                Case "Settle_Debit"
                    PublicVariable.Settle_Debit = dt.Rows(i).Item("Settle_Debit")
                Case "Settle_Foreign"
                    PublicVariable.Settle_Foreign = dt.Rows(i).Item("Settle_Foreign")
                Case "Table_Move"
                    PublicVariable.Table_Move = dt.Rows(i).Item("Table_Move")
                Case "Table_Split"
                    PublicVariable.Table_Split = dt.Rows(i).Item("Table_Split")
                Case "Table_Group"
                    PublicVariable.Table_Group = dt.Rows(i).Item("Table_Group")
                Case "Admin_Report"
                    PublicVariable.Admin_Report = dt.Rows(i).Item("Admin_Report")
                Case "Admin_Log"
                    PublicVariable.Admin_Log = dt.Rows(i).Item("Admin_Log")
                Case "Admin_Reservation"
                    PublicVariable.Admin_Reservation = dt.Rows(i).Item("Admin_Reservation")
                Case "Admin_ToGo"
                    PublicVariable.Admin_ToGo = dt.Rows(i).Item("Admin_ToGo")
                Case "Admin_ToGoList"
                    PublicVariable.Admin_ToGoList = dt.Rows(i).Item("Admin_ToGoList")
                Case "Admin_Attendance"
                    PublicVariable.Admin_Attendance = dt.Rows(i).Item("Admin_Attendance")
                Case "Admin_Delivery"
                    PublicVariable.Admin_Delivery = dt.Rows(i).Item("Admin_Delivery")
                Case "Admin_Configuration"
                    PublicVariable.Admin_Configuration = dt.Rows(i).Item("Admin_Configuration")
                Case "Admin_Customer"
                    PublicVariable.Admin_Customer = dt.Rows(i).Item("Admin_Customer")
                Case "Admin_Item"
                    PublicVariable.Admin_Item = dt.Rows(i).Item("Admin_Item")
                Case "Admin_Sales"
                    PublicVariable.Admin_Sales = dt.Rows(i).Item("Admin_Sales")
                Case "Admin_Synchronize"
                    PublicVariable.Admin_Synchronize = dt.Rows(i).Item("Admin_Synchronize")
                Case "Admin_KeepingList"
                    PublicVariable.Admin_KeepingList = dt.Rows(i).Item("Admin_KeepingList")
                Case "Customer_Search"
                    PublicVariable.Customer_Search = dt.Rows(i).Item("Customer_Search")
                Case "Customer_New"
                    PublicVariable.Customer_New = dt.Rows(i).Item("Customer_New")
                Case "Customer_Edit"
                    PublicVariable.Customer_Edit = dt.Rows(i).Item("Customer_Edit")
                Case "Print_Order"
                    PublicVariable.Print_Order = dt.Rows(i).Item("Print_Order")
                Case "Print_Bill"
                    PublicVariable.Print_Bill = dt.Rows(i).Item("Print_Bill")
                Case "Print_Kitchen"
                    PublicVariable.Print_Kitchen = dt.Rows(i).Item("Print_Kitchen")
            End Select
        Next
    End Sub    
    Public Shared Sub LoadReference()
        Dim dt As DataTable

        dt = BLL.ObjectGetAll("REFERENCE_LOAD")
        For i As Integer = 0 To dt.Rows.Count - 1
            Select Case dt.Rows(i).Item("REF_Code").ToString
                Case "_Version"
                    PublicVariable.AppVersion = dt.Rows(i).Item("REF_Value").ToString
            End Select
        Next
    End Sub
    Public Shared Sub LoadAllConfiguration()
        
        Dim dt1 As DataTable
        dt1 = BLL.ObjectGetAll("CONFIGURATION_LOADALL")
        For i As Integer = 0 To dt1.Rows.Count - 1
            Select Case dt1.Rows(i).Item("Name").ToString
                Case "ServerIP"
                    PublicVariable.ServerIP = dt1.Rows(i).Item("value").ToString
                Case "ServerPort"
                    PublicVariable.ServerPort = dt1.Rows(i).Item("value").ToString
                Case "POSCode"
                    PublicVariable.POSCode = dt1.Rows(i).Item("value").ToString
                    'Case "POSStoreCode"
                    '    PublicVariable.POSStoreCode = dt1.Rows(i).Item("value").ToString
                Case "POSIntervalClear"
                    PublicVariable.POSIntervalClear = dt1.Rows(i).Item("value").ToString
                Case "DrawerType"
                    PublicVariable.DrawerType = dt1.Rows(i).Item("value").ToString
                Case "DrawerPort"
                    PublicVariable.DrawerPort = dt1.Rows(i).Item("value").ToString
                Case "OrderPrintOLE"
                    PublicVariable.OrderPrintOLE = dt1.Rows(i).Item("value").ToString
                Case "OrderPrintName"
                    PublicVariable.OrderPrintName = dt1.Rows(i).Item("value").ToString
                Case "OrderPrintPort"
                    PublicVariable.OrderPrintPort = dt1.Rows(i).Item("value").ToString
                Case "OrderPrintSlipCount"
                    PublicVariable.OrderPrintSlipCount = dt1.Rows(i).Item("value").ToString
                Case "OrderPrintSubItem"
                    PublicVariable.OrderPrintSubItem = dt1.Rows(i).Item("value").ToString
                Case "OrderPrintAuto"
                    PublicVariable.OrderPrintAuto = dt1.Rows(i).Item("value").ToString
                Case "KitchenPrintOLE"
                    PublicVariable.KitchenPrintOLE = dt1.Rows(i).Item("value").ToString
                Case "KitchenPrintName"
                    PublicVariable.KitchenPrintName = dt1.Rows(i).Item("value").ToString
                Case "KitchenPrintPort"
                    PublicVariable.KitchenPrintPort = dt1.Rows(i).Item("value").ToString
                Case "KitchenPrintSlipCount"
                    PublicVariable.KitchenPrintSlipCount = dt1.Rows(i).Item("value").ToString
                Case "KitchenPrintSubItem"
                    PublicVariable.KitchenPrintSubItem = dt1.Rows(i).Item("value").ToString
                Case "KitchenPrintAuto"
                    PublicVariable.KitchenPrintAuto = dt1.Rows(i).Item("value").ToString
                Case "ReceiptPrintOLE"
                    PublicVariable.ReceiptPrintOLE = dt1.Rows(i).Item("value").ToString
                Case "ReceiptPrintName"
                    PublicVariable.ReceiptPrintName = dt1.Rows(i).Item("value").ToString
                Case "ReceiptPrintPort"
                    PublicVariable.ReceiptPrintPort = dt1.Rows(i).Item("value").ToString
                Case "ReceiptPrintSlipCount"
                    PublicVariable.ReceiptPrintSlipCount = dt1.Rows(i).Item("value").ToString
                Case "ReceiptPrintSubItem"
                    PublicVariable.ReceiptPrintSubItem = dt1.Rows(i).Item("value").ToString
                Case "ReceiptPrintAuto"
                    PublicVariable.ReceiptPrintAuto = dt1.Rows(i).Item("value").ToString
                Case "CustomerDisplayType"
                    PublicVariable.CustomerDisplayType = dt1.Rows(i).Item("value").ToString
                Case "CustomerDisplayPort"
                    PublicVariable.CustomerDisplayPort = dt1.Rows(i).Item("value").ToString
                Case "MSRType"
                    PublicVariable.MSRType = dt1.Rows(i).Item("value").ToString
                Case "MSRPort"
                    PublicVariable.MSRPort = dt1.Rows(i).Item("value").ToString
                Case "MSRTrack"
                    PublicVariable.MSRTrack = dt1.Rows(i).Item("value").ToString
                Case "MSRMark"
                    PublicVariable.MSRMark = dt1.Rows(i).Item("value").ToString
                Case "BarcodeType"
                    PublicVariable.BarcodeType = dt1.Rows(i).Item("value").ToString
                Case "BarcodePort"
                    PublicVariable.BarcodePort = dt1.Rows(i).Item("value").ToString
                Case "Screen"
                    PublicVariable.Screen = dt1.Rows(i).Item("value").ToString
                Case "ApplicationType"
                    PublicVariable.ApplicationType = dt1.Rows(i).Item("value").ToString
                Case "OrderPrintFilePath"
                    PublicVariable.OrderPrintFilePath = Application.StartupPath + "\Report\" + dt1.Rows(i).Item("value").ToString
                Case "KitchenPrintFilePath"
                    PublicVariable.KitchenPrintFilePath = Application.StartupPath + "\Report\" + dt1.Rows(i).Item("value").ToString
                Case "ReceiptPrintFilePath"
                    PublicVariable.ReceiptPrintFilePath = Application.StartupPath + "\Report\" + dt1.Rows(i).Item("value").ToString
                Case "LocalCurrency"
                    PublicVariable.LocalCurrency = dt1.Rows(i).Item("value").ToString
                Case "ForeignCurrency"
                    PublicVariable.ForeignCurrency = dt1.Rows(i).Item("value").ToString
                Case "ShowPrintPreview"
                    PublicVariable.ShowPrintPreview = dt1.Rows(i).Item("value").ToString
                Case "DecimalNumber"
                    PublicVariable.DecimalNumber = dt1.Rows(i).Item("value").ToString
                Case "DateTimeFormat"
                    PublicVariable.DateTimeFormat = dt1.Rows(i).Item("value").ToString
                Case "KitchenPrintType"
                    PublicVariable.KitchenPrintType = dt1.Rows(i).Item("value").ToString
                Case "VideoFile"
                    PublicVariable.VideoFile = dt1.Rows(i).Item("value").ToString
                Case "WorkingEndTime"
                    PublicVariable.WorkingEndTime = dt1.Rows(i).Item("value").ToString
                Case "WorkingStartTime"
                    PublicVariable.WorkingStartTime = dt1.Rows(i).Item("value").ToString
                Case "DefaultCustomerGroup"
                    PublicVariable.DefaultCustomerGroup = dt1.Rows(i).Item("value").ToString
                Case "ByCash"
                    PublicVariable.ByCash = dt1.Rows(i).Item("value").ToString
                Case "ByVoucher"
                    PublicVariable.ByVoucher = dt1.Rows(i).Item("value").ToString
                Case "ByCreditCard"
                    PublicVariable.ByCreditCard = dt1.Rows(i).Item("value").ToString
                Case "ByMileage"
                    PublicVariable.ByMileage = dt1.Rows(i).Item("value").ToString
                Case "ByDebit"
                    PublicVariable.ByDebit = dt1.Rows(i).Item("value").ToString
                Case "ByForeign"
                    PublicVariable.ByForeign = dt1.Rows(i).Item("value").ToString
                Case "CheckSerial"
                    PublicVariable.CheckSerial = dt1.Rows(i).Item("value").ToString
                Case "BarcodeItem"
                    PublicVariable.BarcodeItem = dt1.Rows(i).Item("value").ToString
                Case "BarcodeCustomer"
                    PublicVariable.BarcodeCustomer = dt1.Rows(i).Item("value").ToString
                Case "BarcodeEmployee"
                    PublicVariable.BarcodeEmployee = dt1.Rows(i).Item("value").ToString
                Case "NegativeInventory"
                    PublicVariable.NegativeInventory = dt1.Rows(i).Item("value").ToString
                Case "LogoFile"
                    PublicVariable.LogoFile = Application.StartupPath + "\" + dt1.Rows(i).Item("value").ToString
                Case "BillEmployee"
                    PublicVariable.BillEmployee = dt1.Rows(i).Item("value").ToString

                Case "SCPercent"
                    PublicVariable.SCPercent = dt1.Rows(i).Item("value").ToString
                Case "SCOption"
                    PublicVariable.SCOption = dt1.Rows(i).Item("value").ToString
            End Select
        Next
    End Sub
End Class
